import axios from "axios";
// const baseurl = 'http://localhost:8081'
// const staticUrl='http://127.0.0.1:80'
const baseurl = 'http://192.168.31.212:8081'
const staticUrl='http://192.168.31.212:80'
export default {
    get: function <T>(url: string, query?: any) {
        const config = {
            baseURL: baseurl,
            params: query,
            withCredentials:true
        }
        return axios.get(url, config).then(re => {
            return re.data
        })
    },
    post: function (url: string, query?: any, data?: any) {
        const config = {
            baseURL: baseurl,
            params: query,
            withCredentials:true
        }
        return axios.post(url, data,config).then(re => {
            return re.data
        })
    },
    pic :function (url:string){
        return staticUrl+'/p'+url+'.jpg'
    },
    video:function (url:string){
        return staticUrl+'/v'+url+'.mp4'
    },
    face :function (url:string){
        return staticUrl+'/'+url+'.jpg'
    },
}